﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Money.GUI
{
    public partial class DirectorySelector : UserControl
    {
        public DirectorySelector()
        {
            InitializeComponent();
        }

        public string Directory 
        {
            get
            {
                return tbDirectory.Text;
            }
            set
            {
                tbDirectory.Text = value;
            }
        }

        private void btnSelect_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            if(!String.IsNullOrWhiteSpace(Directory))
            {
                fbd.SelectedPath = Directory;
            }

            if (fbd.ShowDialog() == DialogResult.OK)
            {
                Directory = fbd.SelectedPath;
                tbDirectory.Text = Directory;
            }
        }
    }
}
